package com.example.warehousems.dao;

import com.example.warehousems.dao.model.JobTicket;
import com.example.warehousems.dao.model.User;
import org.springframework.boot.autoconfigure.batch.BatchProperties;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

public interface JobTicketRepository extends JpaRepository<JobTicket, Integer> {
    List<JobTicket> findAllByProposer(User proposer);
    Page<JobTicket> findAllPageByProposer(User proposer, Pageable pageable);
    List<JobTicket> findAllByAdmin_IdOrderByCreateTimeDesc(Integer adminId);

    Page<JobTicket> findAllPageByAdmin_IdOrderByCreateTimeDesc(Integer adminId, Pageable pageable);
    JobTicket findJobTicketById(Integer id);
    JobTicket findJobTicketByIdAndProposerOrderByCreateTimeDesc(Integer jobTicketId, User proposer);
}
